package archer.application.core.api.internal.system;

import archer.application.core.entity.system.Menu;
import archer.application.core.service.system.MenuService;
import archer.application.core.api.BaseController;
import archer.framework.protocol.result.ExecuteResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author christ
 * @date 2016/6/7
 */
@RestController
@RequestMapping("/api/v*/internal/system/menu")
@Transactional
public class MenuApi extends BaseController {

    @Autowired
    MenuService menuService;

    @RequestMapping("store")
    public ExecuteResult store(Menu menu) {

        return menuService.store(menu);
    }

    @RequestMapping("findList")
    public ExecuteResult findList() {

        return menuService.findList();
    }

    @RequestMapping("delete")
    public ExecuteResult delete(String id) {

        return menuService.delete(id);
    }

    @RequestMapping("findRoleList")
    public ExecuteResult findRoleList(String id, String queryCondition) {

        return menuService.findRoleList(id, asCondition(queryCondition));
    }
}
